package pl.polidea.imf.blackberry.service.statemachine;

import pl.polidea.imf.blackberry.service.IMFService;

public class StateRegistration extends State {
	
	public static final int SUB_STATE_REGISTRATION_GET_USER_DATA = 0;
	public static final int SUB_STATE_REGISTRATION_ONLINE_JOB = 1;
	public static final int SUB_STATE_REGISTRATION_FAILED= 2;
	public static final int SUB_STATE_REGISTRATION_OK= 3;
	
	public StateRegistration(int subState) {
		super(subState);
		
	}

	public State doWork() {
		State nextState = null;
		
		switch (getSubState()) {
			
			case SUB_STATE_REGISTRATION_GET_USER_DATA:
				IMFService.getInstance().getUiController().showEnterUserData();
				break;
			case SUB_STATE_REGISTRATION_OK:
				nextState = new StateLogin(StateLogin.SUB_STATE_LOGIN_LOGIN);
				break;
			case SUB_STATE_REGISTRATION_FAILED:
				nextState = new StateRegistration(StateRegistration.SUB_STATE_REGISTRATION_GET_USER_DATA);
				break;

			default:
				break;
		}
		
		
		return nextState;
	}

}
